@echo off
setlocal

echo PPH Quick File Copy
echo ===================
echo.

set "SOURCE=d:\OneDrive\Desktop\新PPH项目"
set "TARGET=%~dp0..\app"

echo Source: %SOURCE%
echo Target: %TARGET%
echo.

if not exist "%SOURCE%" (
    echo ERROR: Source not found!
    echo Please modify SOURCE path in this script.
    pause
    exit /b 1
)

echo Creating directories...
mkdir "%TARGET%" 2>nul
mkdir "%TARGET%\backend" 2>nul
mkdir "%TARGET%\frontend" 2>nul
mkdir "%TARGET%\backend\data" 2>nul
mkdir "%TARGET%\logs" 2>nul

echo Copying backend...
robocopy "%SOURCE%\backend" "%TARGET%\backend" /E /XD node_modules .git logs uploads temp /XF *.log *.tmp package-lock.json /NFL /NDL /NJH /NJS

echo Copying frontend...
robocopy "%SOURCE%\frontend" "%TARGET%\frontend" /E /XD node_modules .git dist /XF *.log *.tmp package-lock.json /NFL /NDL /NJH /NJS

echo Copying database...
copy "%SOURCE%\backend\data\pph.sqlite" "%TARGET%\backend\data\" >nul 2>&1

echo Copying other files...
copy "%SOURCE%\check-staff-fields.cjs" "%TARGET%\" >nul 2>&1
copy "%SOURCE%\legacyDb.db" "%TARGET%\" >nul 2>&1

echo.
echo Copy completed!
echo Next: Run scripts\deploy-cmd.bat
echo.
pause
